home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / opcodes / disassemble.c < prev    next >
C/C++ Source or Header  |  1994-09-05  |  4KB  |  155 lines

  1. /* Select disassembly routine for specified architecture.
  2.    Copyright 1994 Free Software Foundation, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. #include "ansidecl.h"
  19. #include "dis-asm.h"
  20.  
  21. #ifdef ARCH_all
  22. #define ARCH_a29k
  23. #define ARCH_alpha
  24. #define ARCH_arm
  25. #define ARCH_h8300
  26. #define ARCH_h8500
  27. #define ARCH_hppa
  28. #define ARCH_i386
  29. #define ARCH_i960
  30. #define ARCH_m68k
  31. #define ARCH_m88k
  32. #define ARCH_mips
  33. #define ARCH_ns32k
  34. #define ARCH_powerpc
  35. #define ARCH_rs6000
  36. #define ARCH_sh
  37. #define ARCH_sparc
  38. #define ARCH_z8k
  39. #endif
  40.  
  41. disassembler_ftype
  42. disassembler (abfd)
  43.      bfd *abfd;
  44. {
  45.   enum bfd_architecture a = bfd_get_arch (abfd);
  46.   disassembler_ftype disassemble;
  47.  
  48.   switch (a)
  49.     {
  50.       /* If you add a case to this table, also add it to the
  51.      ARCH_all definition right above this function.  */
  52. #ifdef ARCH_a29k
  53.     case bfd_arch_a29k:
  54.       /* As far as I know we only handle big-endian 29k objects.  */
  55.       disassemble = print_insn_big_a29k;
  56.       break;
  57. #endif
  58. #ifdef ARCH_alpha
  59.     case bfd_arch_alpha:
  60.       disassemble = print_insn_alpha;
  61.       break;
  62. #endif
  63. #ifdef ARCH_arm
  64.     case bfd_arch_arm:
  65.       disassemble = print_insn_arm;
  66.       break;
  67. #endif
  68. #ifdef ARCH_h8300
  69.     case bfd_arch_h8300:
  70.       if (bfd_get_mach(abfd) == bfd_mach_h8300h)
  71.     disassemble = print_insn_h8300h;
  72.       else 
  73.     disassemble = print_insn_h8300;
  74.       break;
  75. #endif
  76. #ifdef ARCH_h8500
  77.     case bfd_arch_h8500:
  78.       disassemble = print_insn_h8500;
  79.       break;
  80. #endif
  81. #ifdef ARCH_hppa
  82.     case bfd_arch_hppa:
  83.       disassemble = print_insn_hppa;
  84.       break;
  85. #endif
  86. #ifdef ARCH_i386
  87.     case bfd_arch_i386:
  88.       disassemble = print_insn_i386;
  89.       break;
  90. #endif
  91. #ifdef ARCH_i960
  92.     case bfd_arch_i960:
  93.       disassemble = print_insn_i960;
  94.       break;
  95. #endif
  96. #ifdef ARCH_m68k
  97.     case bfd_arch_m68k:
  98.       disassemble = print_insn_m68k;
  99.       break;
  100. #endif
  101. #ifdef ARCH_m88k
  102.     case bfd_arch_m88k:
  103.       disassemble = print_insn_m88k;
  104.       break;
  105. #endif
  106. #ifdef ARCH_ns32k
  107.     case bfd_arch_ns32k:
  108.       disassemble = print_insn_ns32k;
  109.       break;
  110. #endif
  111. #ifdef ARCH_mips
  112.     case bfd_arch_mips:
  113.       if (abfd->xvec->byteorder_big_p)
  114.     disassemble = print_insn_big_mips;
  115.       else
  116.     disassemble = print_insn_little_mips;
  117.       break;
  118. #endif
  119. #ifdef ARCH_powerpc
  120.     case bfd_arch_powerpc:
  121.       if (abfd->xvec->byteorder_big_p)
  122.     disassemble = print_insn_big_powerpc;
  123.       else
  124.     disassemble = print_insn_little_powerpc;
  125.       break;
  126. #endif
  127. #ifdef ARCH_rs6000
  128.     case bfd_arch_rs6000:
  129.       disassemble = print_insn_rs6000;
  130.       break;
  131. #endif
  132. #ifdef ARCH_sh
  133.     case bfd_arch_sh:
  134.       disassemble = print_insn_sh;
  135.       break;
  136. #endif
  137. #ifdef ARCH_sparc
  138.     case bfd_arch_sparc:
  139.       disassemble = print_insn_sparc;
  140.       break;
  141. #endif
  142. #ifdef ARCH_z8k
  143.     case bfd_arch_z8k:
  144.       if (bfd_get_mach(abfd) == bfd_mach_z8001)
  145.     disassemble = print_insn_z8001;
  146.       else 
  147.     disassemble = print_insn_z8002;
  148.       break;
  149. #endif
  150.     default:
  151.       return 0;
  152.     }
  153.   return disassemble;
  154. }
  155.